<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
  <head>
    <title> member_list </title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
    <?php htmlhead(); ?>
  </head>
  
  <body>
    
    <div class="panel">
      <div class="t">下挂角色列表</div>
    </div>
    
    <div class="actbar menuborder">
      <ul>
        <li class="add"><a href="?view=member_add" title="新增">新增</a></li>
        <li class="delete" title="删除后将不可恢复"><a href="javascript:deleteMulti();" onclick="return confirm('确定删除?')">删除</a></li>
      </ul>
      <ul class="pages">
        <li><?php echo '共'.$navi['total'].'条 ',$navi['page'], '/', $navi['pages'];?>页</li>
        <li>
        <?php
          if($navi['page']==1) {
            echo('<a href="?view=member_list&page='.($navi['page']+1).'">下一页</a> ');
          }
          elseif($navi['page']==$navi['pages']){
            echo('<a href="?view=member_list&page='.($navi['page']-1).'">上一页</a> ');
          }
          else {
            echo('<a href="?view=member_list&page='.($navi['page']-1).'">上一页</a> ');
            echo('<a href="?view=member_list&page='.($navi['page']+1).'">下一页</a> ');
          }
        ?>
        </li>
      </ul>
    </div>
    
    <table class="table">
      <thead>
        <tr>
          <th style="width:28px;" class="trall"></th>
          <th style="width:30px;">ID</th>
          <th style="width:auto;">角色</th>
          <th style="width:50px;">阶级</th>
          <th style="width:50px;">种族</th>
          <th style="width:50px;">职业</th>
          <th style="width:30px;">等级</th>
          <th style="width:30px;">次数</th>
          <th style="width:64px;">首次Raid</th>
          <th style="width:64px;">最后Raid</th>
          <th style="width:170px;">操作</th>
        </tr>        
      </thead>
      <tbody>
      <?php
        foreach($data as $_=>$v) {
          echo('<tr id="'.$v['member_id'].'">');
          echo(' <td class="status"></td>');
          echo(' <td>'.$v['member_id'].'</td>');
          echo(' <td><strong>'.($v['parent_id'] ? '<span class="red">*</span> ' : '').$v['member_name'].'</strong></td>');
          echo(' <td>'.$v['member_rank'].'</td>');
          echo(' <td>'.$v['member_race'].'</td>');
          echo(' <td>'.$v['member_class'].'</td>');
          echo(' <td>'.$v['member_level'].'</td>');
          echo(' <td>'.$v['raidcount'].'</td>');
          echo(' <td>'.($v['firstraid'] ? date('Y-m-d',$v['firstraid']) : '').'</td>');
          echo(' <td>'.($v['lastraid'] ? date('Y-m-d',$v['lastraid']) :'').'</td>');
          echo(' <td>');
          echo('  <span class="acticon actedit"><a href="?view=member_edit&id='.$v['member_id'].'">修改</a></span>');
          echo('  <span class="acticon actrecycle"><a onclick="return confirm(\'确定删除?\')" href="?act=member_delete&id='.$v['member_id'].'">删除</a></span>');
          echo(' </td>');
          echo('</tr>');
        }
      ?>
      </tbody>
    </table>

    <div class="actbar menuborder">
      <ul>
        <li class="add"><a href="?view=member_add" title="新增">新增</a></li>
        <li class="delete" title="删除后将不可恢复"><a href="javascript:deleteMulti();" onclick="return confirm('确定删除?')">删除</a></li>
      </ul>
      <ul class="pages">
        <li><?php echo '共'.$navi['total'].'条 ',$navi['page'], '/', $navi['pages'];?>页</li>
        <li>
        <?php
          if($navi['page']==1) {
            echo('<a href="?view=member_list&page='.($navi['page']+1).'">下一页</a> ');
          }
          elseif($navi['page']==$navi['pages']){
            echo('<a href="?view=member_list&page='.($navi['page']-1).'">上一页</a> ');
          }
          else {
            echo('<a href="?view=member_list&page='.($navi['page']-1).'">上一页</a> ');
            echo('<a href="?view=member_list&page='.($navi['page']+1).'">下一页</a> ');
          }
        ?>
        </li>
      </ul>
    </div>
    
    <script>
      function getIDS() {
        var ids = '';
        $('.table .trselected').each(function(){
          ids += $(this).attr('id') + ',';
        });
        return ids.replace(/,$/,"");
      }
      function deleteMulti() {
        var ids = getIDS();
        if(ids) {
          location.href = "?act=member_delete&ids="+ids;
        }
      }
      $(document).ready(function(){
        $(".actbar [title]").tipsy({gravity:'s'});
        $(".table .status").click(function(){
          if ($(this).hasClass('ck')) {
            $(this).removeClass('ck');
            $(this).parent().removeClass('trselected');
          } else {
            $(this).addClass('ck');
            $(this).parent().addClass('trselected');
          }
        });        
        $(".table tr").hover(function() {
          if ($(this).hasClass('trhover'))
            $(this).removeClass('trhover');
          else
            $(this).addClass('trhover');          
        });
        $(".table .trall").click(function(){
          $(".table .status").each(function(){
            if ($(this).hasClass('ck')) {
              $(this).removeClass('ck');
              $(this).parent().removeClass('trselected');
            } else {
              $(this).addClass('ck');
              $(this).parent().addClass('trselected');
            }
          });
        });
      });
    </script>
    
    <script>
    <?php echo getTips(); ?>
    </script>
    
</body>
</html>